﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace CoolERP_Common
{
    [XmlRoot("root")]
    public class XmlOption
    {
        public XmlOptionItem[] items { get; set; }
        /// <summary>
        /// 反序列化
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public static XmlOption DserializeOptionValues(string xml)
        {
            if (!string.IsNullOrEmpty(xml))
            {
                XmlOption option = IOHelper.XMLDeserialize<XmlOption>(xml);
                return option;
            }
            return null;
        }

        /// <summary>
        /// 序列化成字符串
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public static string SerializeOptionValues(XmlOption xml)
        {
            return IOHelper.XMLSerializeAsString<XmlOption>(xml);
        }
    }

    /// <summary>
    /// 
    /// </summary>
    public class XmlOptionItem
    {

        private string _index;
        /// <summary>
        /// 获取/设置 索引 
        /// </summary>
        public virtual string index
        {
            get { return _index; }
            set { _index = value; }
        }

        private string _values;
        /// <summary>
        /// 获取/设置 索引值
        /// </summary>
        public virtual string values
        {
            get { return _values; }
            set { _values = value; }
        }
    }
}
